﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace Framework_Tool
{
    /// <summary>
    /// Interaction logic for StudentDelete.xaml
    /// </summary>
    public partial class StudentDelete : Page
    {
        public StudentDelete()
        {
            InitializeComponent();
            Database.FindStdtID_Delete(this);
        }

        private void mainContent_Loaded_1(object sender, RoutedEventArgs e)
        {
            viewStudentBtn.FontWeight = FontWeights.Normal;
            addStudentBtn.FontWeight = FontWeights.Normal;
            updateStudentBtn.FontWeight = FontWeights.Normal;
            deleteStudentBtn.FontWeight = FontWeights.ExtraBold;
            searchStudentBtn.FontWeight = FontWeights.Normal;
        }

        private void addStudentBtn_Click_1(object sender, RoutedEventArgs e)
        {
            StudentAdd stdtAddWindow = new StudentAdd();
            stdtAddWindow.Content = null;
            mainContent.Children.Add(stdtAddWindow.mainContent);
        }

        private void updateStudentBtn_Click_1(object sender, RoutedEventArgs e)
        {
            StudentUpdate stdtUpdateWindow = new StudentUpdate();
            stdtUpdateWindow.Content = null;
            mainContent.Children.Add(stdtUpdateWindow.mainContent);
        }

        private void searchStudentBtn_Click_1(object sender, RoutedEventArgs e)
        {
            StudentSearch stdtSearchWindow = new StudentSearch();
            stdtSearchWindow.Content = null;
            mainContent.Children.Add(stdtSearchWindow.mainContent);
        }

        private void viewStudentBtn_Click_1(object sender, RoutedEventArgs e)
        {
            StudentView stdtViewWindow = new StudentView();
            stdtViewWindow.Content = null;
            mainContent.Children.Add(stdtViewWindow.mainContent);
        }

        private void stdtDelete_Click_1(object sender, RoutedEventArgs e)
        {
            Database.DeleteStudent(this);
            stdtIDDeleteCmbx.Items.Clear();
            Database.FindStdtID_Delete(this);
        }

        private void stdtIDDeleteCmbx_SelectionChanged_1(object sender, SelectionChangedEventArgs e)
        {
            Database.populateStdtDeleteFields(this);
        }

        private void cancelStdtDelete_Click_1(object sender, RoutedEventArgs e)
        {
            stdtIDDeleteCmbx.SelectedItem = null;
            stdtFNameTxt.Text = null;
            stdtSurnameTxt.Text = null;
            stdtCourseIDTxt.Text = null;
            stdtTelNoTxt.Text = null;
            stdtEmailTxt.Text = null;
            stdtDeletedLblGrid.Visibility = Visibility.Hidden;
        }
    }
}
